from lib import CodecLib
if __name__ != '__main__':
    nowd = {}
    nowd['sub1'] = {}
    nowd['sub1']['s1'] = '000000\n'
    nowd['sub1']['s2'] = '111111'
    nowd['sub2'] = {}
    nowd['sub2']['s1'] = 'aaaaaa'
    nowd['sub2']['s2'] = 'bbbbbb'

    f = open('data/tmp.json', 'w+')
    f.write(CodecLib.json_encode(nowd))
    f.close()
else:
    f = open('data/tmp.json', 'r')
    dit = f.read()
    print(CodecLib.json_decode(dit.replace('\n', '')))
